<template>
	<view>
		<uni-popup ref="commendRef" type="bottom" :maskClick="false">
			<view class="">
				<view class="body">
					<view class="tray_data">
						<uni-forms :modelValue="moldData" >
							<uni-forms-item label="仓位:" name="locationName">
								<input type="text" v-model="moldData.locationName" disabled />
							</uni-forms-item>
							<uni-forms-item label="模具名称:" name="materialName">
								<input type="text" v-model="moldData.materialName" disabled   />
							</uni-forms-item>
							<uni-forms-item label="模具编码:" name="materialNo">
								<input type="text" v-model="moldData.materialNo" disabled />
							</uni-forms-item>
							<uni-forms-item label="使用总次数:" name="useAllCount">
								<input type="text" v-model="moldData.useAllCount" disabled />
							</uni-forms-item>
							<uni-forms-item label="当前使用次数:" name="useCount">
								<input type="text" v-model="moldData.useCount" disabled />
							</uni-forms-item>
						</uni-forms>
					</view>
					<view class="footerPanel">
						<view class="footerPanel_body">
							<button @click="closeInfoPop" class="footerBtn concle" ><i
									></i>取消
							</button>
							<button @click="savePickMold" class="footerBtn save" ><i
									class="iconfont icon-duihao btn_icon" ></i>提交
							</button>
							
						</view>
					</view>
				</view>
			</view>
		</uni-popup>
		<!-- 扫描仓位码后弹出领料界面，可以修改领料信息 -->
		<add-pick ref="pickRef"></add-pick>
	
	</view>
</template>

<script>

	import {pickMoldByorderNo}  from '@/utils/api.js'
	import AddPick from "@/pages/pop/add-pick-commend.vue"
	
	export default {
		components: {
			AddPick
			
		},
		data() {
			return {
				moldData:{},//模具信息
				planData : {} //工序计划数据
				
			};
		},
		methods: {
			//领用模具
			savePickMold(){
				let _this = this
				uni.showModal({
					title:'提示',
					content:'确认领用',
					success(res) {
						if (res.confirm){
							pickMoldByorderNo({moldData : _this.moldData,planData : _this.planData}).then(result => {
							if (result.data.data){
								uni.showToast({
									title:'模具领用成功',
									icon:'none'
								})
							}
							_this.$emit('success')
						
							_this.close()
							})
						
						}
					}
				})
			},
			
			
		
		
			closeInfoPop() {
				this.$refs.commendRef.close()
			},
			
			open(data) {
				this.moldData = data.moldData
				this.planData = data.header
				this.$refs.commendRef.open('center')
	
			},
			close() {
				this.$refs.commendRef.close()
			}
		},
		onLoad() {
		
		}
	}
</script>

<style lang="scss">

	.body{
		background-color: aliceblue;
	}
	.tray_data{
		
		width: 100%;
		height: 50%;
		margin-left: 3px;
	}
	// 底部按钮
	.footerPanel {
	  height: 40px;

	  .footerPanel_body {
	    left: 0;
	    bottom: 0;
	    width: calc(100% - 14px);
	    display: flex;
	    position: fixed;
	    padding: 10px 7px;
	
	    .footerBtn {
	      height: 40px;
	      margin: 0 5px;
	      display: flex;
	      line-height: 1;
	      font-size: 14px;
	      border-radius: 4px;
	      align-items: center;
	      justify-content: center;
	      box-shadow: 0 0 5px rgba(201, 201, 201, 0.5);
	      color: #fff;
		  
		  &.onlyBtn {
			flex: 1 !important;
			// margin: 0 !important;
		  }
	
	      &.save {
	        background-color: $uni-color-success;
	        width: 150px;
	        flex-shrink: 0;
			margin-left: 50px;
			margin-bottom: 50px;
	      }
	
	      &.reset {
	        background: $bg-page;
	        color: $font-hb;
	        width: 80px;
	        flex-shrink: 0;
	      }
		  &.concle {
				background-color: darkgrey;
			    width: 100px;
			    flex-shrink: 0;
				margin-left: 30px;
			  }
	      &.scan {
	        background: $primary;
			
	        flex: 1;
	      }
	    }
	
	    .btn_icon {
	      margin-right: 8px;
	    }
	  }
	}
</style>
